Skip to content

Fix support for void nodes #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2021
Merged

Fix support for void nodes #6

merged 1 commit into from
May 4, 2021

Conversation

staltz
Copy link
Contributor

@staltz staltz commented May 3, 2021

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

I tested and deployed this change in staltz/strip-markdown-oneline@347709e too

Closes #5

@wooorm
Copy link
Member

wooorm commented May 3, 2021

See #5 (comment).

But if this was causing an exception, then I do think unknown nodes (such as break) should be ignored and handled gracefully

@staltz
Copy link
Contributor Author

staltz commented May 3, 2021

Perhaps this PR could be generalized so that nodes that don't have the required fields would be ignored.

@wooorm
Copy link
Member

wooorm commented May 3, 2021

Yeah. I think if you do:

children = ('length' in node ? node : node.children) || []

on what was L28 that’d work fine?

@wooorm
Copy link
Member

wooorm commented May 3, 2021

And a test of the form:

t.equal(toString(u('foo')), '', 'should support voids')

@staltz
Copy link
Contributor Author

staltz commented May 4, 2021

Good morning @wooorm! I updated this PR according to your suggestions :)

@wooorm wooorm changed the title Handle nodes of type break Fix support for void nodes May 4, 2021
@wooorm wooorm merged commit 37c315f into syntax-tree:main May 4, 2021
@wooorm wooorm added the 💪 phase/solved Post is done label May 4, 2021
@wooorm
Copy link
Member

wooorm commented May 4, 2021

Good morning André! 🌞 Thanks, released in 3.0.1!

@staltz staltz deleted the patch-1 branch May 4, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

Successfully merging this pull request may close these issues.

"break" nodes not handled and cause a TypeError exception
2 participants